Write about Datatypes in SQL Server? Ashutosh Kumar Verma41715-Nov-2021 Write about Datatypes in SQL Server?mssql serversql server sql Updated on 15-Nov-2021
Steilla Mitchel
15-Nov-2021Datatype in SQL Server:
There are following types of data types in SQL, so let us know them in detail,
Numeric Datatypes:
There are the following types of exact numeric data types in SQL,
Int: The range of int ranges from -2,147,483,648 to +2,147,483,648. It requires storage of 4 bytes.
Bigint: Range of Bigint ranges from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,808. It requires 8 bytes of storage.
Smallint: Its range ranges from -32,768 to +32,768. It requires storage of 2 bytes.
Tinyint: Its range is from 0 to 255. It requires storage of 1 bytes.
Bit: The range of bit data type is from 0 to 1. It requires storage of 1 bytes.
Money: The range of this data type ranges from -922,337,203,685,477.5808 to +922,337,203,685,477.5808. It requires 8 bytes of storage.
Smallmoney: The range of this data type ranges from -214,748.3648 to +214,748.3648. It requires 4 bytes.
Decimal: Its range ranges from -10^38+1 to +10^38+1.
Numeric: Its range also ranges from -10^38+1 to +10^38+1.
Datetime Datatype:
The following types of datetime data types are there in SQL,
Date: This data type stores the value of year, month, and day. It requires 3 bytes of storage.
Time: This data type stores the value of hour, minute, and second.
Smalldatetime: This data type requires 8 bytes of storage.
Character Datatype:
The following types of character data types are there in SQL.
1 Char.
2Varchar.
3 Varchar(MAX).
4 Text.
Unicode Character Datatype:
There are following types of Unicode characters.
1 nchar
2 nvarchar.
3 nvarchar(max).
4 ntext.
Binary Datatype:
1 Binary.
2 Varbinary.
3 Varbinary(max).
4 Image.
Boolean Datatype:
There are only two value contain Boolean data type that is ‘true’ or ‘false’.